package com.坦克大战.Tank_2;

import java.util.Vector;

public class MyTank extends Tank {
    Shoot shoot = null;
    Vector<Shoot> TankBullets  = new Vector<>();

    public MyTank(int x, int y, int speed) {
        super(x, y, speed);
    }

    public void shootEnemyTank() {

        switch (getDirection()) {//获取坦克方向，创建坦克的子弹方向；
            case 0:
                shoot = new Shoot(getX() + 20, getY(), 0);
                TankBullets.add(shoot);
            break;
            case 1:
                shoot = new Shoot(getX(), getY() + 20, 1);
                TankBullets.add(shoot);
                break;
            case 2:
                shoot = new Shoot(getX() + 20, getY() + 60, 2);
                TankBullets.add(shoot);
                break;
            case 3:
                shoot = new Shoot(getX() + 60, getY() + 20, 3);
                TankBullets.add(shoot);
                break;
        }

        new Thread(shoot).start();
    }


}
